Objects and primitive data.
A primitive data type uses a small amount of memory
to represent data using bit patterns.
For example, primitive type int
represents
integers using 32 bits.
There are only eight primitive data types in Java:
byte
, short
, int
, long
,
float
, double
, char
, and boolean
.
It is not possible for a Java program to define any other primitive data types.
An object is a large chunk of memory that can potentially contain a great deal of data along with methods (little programs) to process data. There are hundreds of object classes that come standard with Java, and a programmer can easily create additional classes.
Objects are so useful that we need to start using them now, even though they will not be fully discussed until chapter 25.
Can objects contain primitive data?